/**
 * GoodsDownload 业务逻辑实现类
 * @author WangXinLei
 * @date 2015-01-28
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.GoodsDownload;
import com.chnbst.bstyun.model.vo.GoodsDownloadVo;
import com.chnbst.bstyun.service.GoodsDownloadService;

@Transactional
@Service
public class GoodsDownloadServiceImpl extends BaseService implements GoodsDownloadService{

	//命名空间
	private final static String nameSpace = "com.chnbst.bstyun.mapper.GoodsDownloadMapper";

	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<GoodsDownloadVo> selectGrids() {
		return (List<GoodsDownloadVo>) DaoHelper.list(nameSpace, "selectGrids", null);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public GoodsDownloadVo selectById(String goodsDownloadId) {
		return (GoodsDownloadVo) DaoHelper.query(nameSpace, "selectById", goodsDownloadId);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertGoodsDownload(GoodsDownload goodsDownload) {
		return DaoHelper.insert(nameSpace, "insertGoodsDownload", goodsDownload);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateById(GoodsDownload goodsDownload) {
		return DaoHelper.update(nameSpace, "updateById", goodsDownload);
	}

	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public GoodsDownload selectByIdNum(Integer id) {
		return (GoodsDownload) DaoHelper.query(nameSpace, "selectByIdNum", id);
	}

	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<GoodsDownloadVo> selectAllGrids(Map<String, Object> map) {
		return (List<GoodsDownloadVo>) DaoHelper.list(nameSpace, "selectAllGrids", map);
	}

	@Override
	public int selectAllGridsCount() {
		return DaoHelper.count(nameSpace, "selectAllGridsCount", null);
	}
}
